import { useQueryClient } from "@tanstack/react-query";

export function BodyState({ device }: { device: Pick<Device, "guid"> }) {

    const queryClient = useQueryClient();

    let msg = queryClient.getQueryData<DeviceState>(["state", device.guid]);

    let value: boolean = msg?.metrics.find((i) => i.name === "body")?.value;


    return (
        <>
            <p>
                {
                    value ? "有人" : "没人"
                }
            </p>

        </>

    )

}
